/*
 * @Author: SimonCK666 SimonYang223@163.com
 * @Date: 2022-05-06 15:08:08
 * @LastEditors: SimonCK666 SimonYang223@163.com
 * @LastEditTime: 2022-05-06 15:25:43
 * @FilePath: \golang-concept\L2_goarray\array.go
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package main

import "fmt"

func array_basic() {
	var a1 [2]int
	var a2 [3]string
	fmt.Printf("a1: %T\n", a1)
	fmt.Printf("a2: %T\n", a2)
	fmt.Printf("a1: %v\n", a1)
	fmt.Printf("a2: %v\n", a2)

	// 数组初始化
	var a3 = [2]int{1, 2}
	var a4 = [...]int{2, 3}
	fmt.Printf("a3: %v\n", a3)
	fmt.Printf("a4: %v\n", a4)
	fmt.Printf("len(a4): %v\n", len(a4))

	for i := 0; i < len(a4); i++ {
		fmt.Printf("a[%v]: %v\n", i, a4[i])
	}

	for _, v := range a4 {
		fmt.Printf("%v\t", v)
	}
}
